#include <iostream>
#include <string>
#include <limits>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::istream;

void checkStreamStatus(istream & is){
    cout << is.good() << endl;
    cout << is.fail() << endl;
    cout << is.bad() << endl;
    cout << is.eof() << endl;
}

void test0(){
    checkStreamStatus(cin);
    int num = 10;
    cin >> num;
    cout << "num:" << num << endl;
    checkStreamStatus(cin);

    if(!cin.good()){
        //恢复流的状态
        cin.clear();
        //清空缓冲区
        cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');

    }

    cout << endl;
    checkStreamStatus(cin);
    /* int num2 = 1; */
    /* cin >> num2; */
    /* cout << "num2:" << num2 << endl; */
    /* checkStreamStatus(cin); */

    string line;
    cin >> line;
    cout << "line:" << line << endl;
    checkStreamStatus(cin);

}

int main(void){
    test0();
    return 0;
}
